package String;

import java.util.Arrays;

public class turnCharDemo1 {
    public static void main(String[] args) {
        String arr = new String("hello java");
        //变成大写
        System.out.println(arr.toUpperCase());
        //
        char[] c = arr.toCharArray();
        System.out.println(Arrays.toString(c) + "+++");
        char[] c1 = toCharArray(arr);
        System.out.print("[");
        for (char c2 : c1) {
            System.out.print(c2+",");
        }
        System.out.println("]");
    }
    public static char[] toCharArray(String str) {
        char[] array= new char[str.length()];
        if (str.length() == 0)
            return null;//字符串转字符数组
        for (int i = 0; i < str.length(); i++) {
            array[i] = str.charAt(i);
        }
        return array;
    }
}
